package com.hao1st.service2.biz.indexdemo;

import jakarta.servlet.http.HttpServletRequest;
import org.springframework.http.HttpHeaders;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class IndexDemoController {

    /**
     * 浏览器访问
     * @return
     */
    @GetMapping("/index")
    public String index(){
        return "您访问的是service2的index";
    }

    /**
     * rpc访问
     * @return
     */
    @PostMapping("/pindex")
    public String postIndex(HttpServletRequest request) {
        return "您访问的是service2的postIndex，会话ID是：" + request.getSession().getId();
    }
}
